﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using CryptoFiles.Logic;

namespace CryptoFiles.Web
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btLogin_Click(object sender, EventArgs e)
        {
            string login = txLogin.Text;
            string passwd = txPasswd.Text;

            if (CryptoUser.CheckCredentials(login, passwd))
            {
                FormsAuthentication.SetAuthCookie(login, false);

                Response.Redirect("MyFiles.aspx");
            }
            else
            {
                lbError.Text = "Неверное имя пользователя или пароль";
                lbError.Visible = true;

            }
        }
    }
}